package com.xywl.escort.adapter.provider;

import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.annotation.ItemProviderTag;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.xywl.escort.R;
import com.xywl.escort.adapter.HomeRvAdapter;
import com.xywl.escort.entity.NormalMultipleEntity;

@ItemProviderTag(
        viewType = HomeRvAdapter.TYPE_TEXT_IMG,
        layout = R.layout.item_home_common
)
public class TextImgItemProvider extends BaseItemProvider<NormalMultipleEntity, BaseViewHolder> {

    @Override
    public void convert(BaseViewHolder helper, NormalMultipleEntity data, int position) {
        helper.setImageResource(R.id.img_common, data.resId);
        helper.setText(R.id.text_common, data.content);
    }

    @Override
    public void onClick(BaseViewHolder helper, NormalMultipleEntity data, int position) {
        switch (position) {
            case 2: {
                ARouter.getInstance().build("/xy/rules").navigation();
            }
            break;
            case 3: {
                ARouter.getInstance().build("/xy/new/welfare").navigation();
            }
            break;
            case 4:{
                ARouter.getInstance().build("/xy/live").navigation();
            }
                break;
            case 5: {
                ARouter.getInstance().build("/xy/web/links")
                        .withString("title", "常见问题")
                        .withString("url", "http://statich5.nmbjvip.com/commonProblem.html")
                        .navigation();
            }
            break;
            default:
                break;
        }
    }

    @Override
    public boolean onLongClick(BaseViewHolder helper, NormalMultipleEntity data, int position) {
        return false;
    }
}
